{% extends 'base.html' %}
{% load humanize %}
{% block page-content %}
{% include 'nav_cat_bar.html' %}

<div class="wrapper wrapper-content animated fadeIn tooltip-demo">
    <div class="row">
        <div class="col-lg-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title ">
                    <button type="button" class="btn btn-primary btn-write btn-xs" data-toggle="tooltip" data-placement="right" title="">网站确认更新平台</button>
                    <div class="ibox-tools">
                    <a class="collapse-link">
                        <i class="fa fa-chevron-up"></i>
                    </a>
                    <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                        <i class="fa fa-wrench"></i>
                    </a>
                    <ul class="dropdown-menu dropdown-user">
                        <li><a href="#">Config option 1</a>
                        </li>
                        <li><a href="#">Config option 2</a>
                        </li>
                    </ul>
                    <a class="close-link">
                        <i class="fa fa-times"></i>
                    </a>
                    </div>
                </div>
                <div class="ibox-content">
                    {% if error_log %}
                        <div class="alert alert-danger text-center">{{ error_log }}</div>
                    {% endif %}
                    <div class="row">
                        <div class="col-sm-10 m-b-xs">
                          {% for num in web_pro_info %}
                                <a class="btn btn-primary btn-write" href="?project={{ num.mini_name }}">{{num.name}}</a>
                          {% endfor %}
                        </div>

                    </div>
                        <form id="nameform" onsubmit="return validate_form(this)">
                        <div class="table-responsive">

                            <table class="table table-hover table-bordered">
                                <thead>
                                  <th class="text-center">编号</th>
                                  <th class="text-center">平台</th>
                                  <th class="text-center">项目</th>
                                  <th class="text-center">当前版本</th>
                                  <th class="text-center">上一次版本</th>
                                </thead>
                                <tbody>
                                    {% for platform,v in plat_dict.items %}
                                        <tr class="text-center">
                                          <td>
                                            <input type="radio" data-toggle="radio" name="platform" onclick="setSelectAll();"  value={{platform}}>
                                          </td>
                                          <td>{{platform}}</td>
                                          {% for num in v %}
                                            <td>{{num}}</td>
                                          {% endfor %}
                                        </tr>
                                    {% endfor %}
                                </tbody>
                            </table>

                        </div>

                        <div>
                            <div class="input-group col-xs-3 has-success">
                               <span class="input-group-addon">网站更新版本号</span>
                               <input type="text" name="gversion" class="form-control" placeholder="SVN版本号">
                             </div>
                        </div><br>

                        </form>
                        <div class="hr-line-dashed"></div>
                        <button type="submit" class="btn btn-success dim"  form="nameform" formmethod="post" formaction="{% url 'web_update_file_info' %}?project={{ project }}" >确定</button>
                </div>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript">

function validate_required(field,alerttxt)
{
with (field)
  {
  if (value==null||value=="")
    {alert(alerttxt);return false}
  else {return true}
  }
}

function validate_form(thisform)
{
with (thisform)
  {

 if(validate_required(gversion,"填写SVN版本号!")==false)
    {gversion.focus();return false}
  }

}
</script>

{%endblock%}